<?php Tag::css('scaffold')?>
<div id="scaffold">
<?php View::content()?>
<h1><?php echo ucwords("$model"),": <span>$action_name</span>" ?></h1>
<?php if ($results->items) : ?>
<table>
    <thead><tr>
    <?php foreach (current($results->items)->fields as $field) : ?>
        <th><?php echo (current($results->items)->get_alias($field))?></th>
    <?php endforeach?>
	<th>Acciones</th>
    </tr></thead>
	<tbody>
    <?php foreach ($results->items as $item) : ?>
        <tr>
            <?php foreach ($item->fields as $field) : ?>
            <td><?php eh($item->$field)?></td>
            <?php endforeach?>
			<td><?php echo Html::linkAction("ver/$item->id",'Ver')?> |
			<?php echo Html::linkAction("editar/$item->id",'Editar')?> |
			<?php echo Html::linkAction("borrar/$item->id",'Borrar', 'onclick="return confirm(\'¿Está seguro?\')"')?>
			</td>
        </tr>
    <?php endforeach?>
	</tbody>
</table>
<?php View::partial('paginators/digg', false, array('page' => $results ,'url' => Router::get('controller_path').'/index')); ?>

<?php else : // Si no hay items?>
<h2>No hay ningún registro</h2>
<?php endif ?>

</div>
<div class="actions">
	<?php echo Html::linkAction("crear/",'Crear registro')?>
</div>
<?php //var_dump($results)?>
